/**
 * Copyright (c) 2011 - 2012 National Library of Medicine
 *
 * Contact: tomasz.adamusiak@nih.gov
 * 
 * This file is part of LOwlINC
 * 
 * LOwlINC is free software: you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 3 of the License, or (at your option) any
 * later version.
 * 
 * LOwlINC is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 * 
 * You should have received a copy of the GNU Lesser General Public License along
 * with LOwlINC. If not, see <http://www.gnu.org/licenses/>.
 */
package gov.nih.nlm.lowlinc.bean;

import gov.nih.nlm.lowlinc.accessionwrapper.LOINCID;
import gov.nih.nlm.lowlinc.accessionwrapper.LOINCPartID;
import gov.nih.nlm.lowlinc.accessionwrapper.LOINCTermID;
import gov.nih.nlm.lowlinc.owlapi.LowlincException;

/**
 * @author Tomasz Adamusiak
 * 
 */
public class LOINCAxialBean {

	public String getPATH_TO_ROOT() {
		return PATH_TO_ROOT;
	}

	public void setPATH_TO_ROOT(String pATH_TO_ROOT) {
		PATH_TO_ROOT = pATH_TO_ROOT;
	}

	public String getSEQUENCE() {
		return SEQUENCE;
	}

	public void setSEQUENCE(String sEQUENCE) {
		SEQUENCE = sEQUENCE;
	}

	public String getIMMEDIATE_PARENT() {
		return IMMEDIATE_PARENT;
	}

	public void setIMMEDIATE_PARENT(String iMMEDIATE_PARENT) {
		IMMEDIATE_PARENT = iMMEDIATE_PARENT;
	}

	public String getCODE() {
		return CODE;
	}

	public LOINCID getChildLOINCID() throws LowlincException {
		if (getCODE().startsWith("LP")) {
			return new LOINCPartID(getCODE());
		} else {
			return new LOINCTermID(getCODE());
		}
	}

	public LOINCPartID getParentPartID() throws LowlincException {
		return new LOINCPartID(getIMMEDIATE_PARENT());
	}

	public void setCODE(String cODE) {
		CODE = cODE;
	}

	public String getCODE_TEXT() {
		return CODE_TEXT;
	}

	public void setCODE_TEXT(String cODE_TEXT) {
		CODE_TEXT = cODE_TEXT;
	}

	private String PATH_TO_ROOT;
	private String SEQUENCE;
	private String IMMEDIATE_PARENT;
	private String CODE;
	private String CODE_TEXT;

	@Override
	public String toString() {
		return "LOINC Axial Record [IMMEDIATE_PARENT=" + IMMEDIATE_PARENT
				+ ", CODE=" + CODE + ", CODE_TEXT=" + CODE_TEXT + "]";
	}

}
